package com.ctrip.corp.obt.shard.configuration;

import com.ctrip.corp.obt.generic.utils.Conditional;

/**
 * 信创数据库表结构读取配置
 */
public interface StoreDatabaseDDLConfig {

    /**
     * Get the value associated with a key.
     *
     * @param k Key to lookup in the config.
     * @return Value for the key or null if no key is present.
     */
    String get(String k);


    /**
     * 用以判断是否使用查询数据库系统表的方式获取字段类型信息
     *
     * @return
     */
    default Boolean enabled() {
        String v = get("storeDatabaseDDL.enabled");
        return Conditional.ofNullable(v).map(Boolean::valueOf).orElse(true);
    }
}
